<template>
  <div>
    <h2 style="margin-top: -10px;
      margin-bottom:20px;
      color:#505458">
      新建项目
    </h2>
    <el-form
      :model="project"
      :rules="projectRules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm">
      <el-form-item label="项目名称:" prop="name">
        <el-input v-model="project.name" style="width: 200px"></el-input>
      </el-form-item>
      <el-form-item label="创建人:" prop="author">
        <span v-model="project.author">{{user.name}}</span>
      </el-form-item>
      <el-form-item label="项目备注:" prop="remarks">
        <el-input type="textarea" v-model="project.remarks" style="width: 360px"></el-input>
      </el-form-item>
    </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelDialog">取 消</el-button>
        <el-button type="primary" @click="conformDialog">确 定</el-button>
      </span>
  </div>
</template>

<script>
  export default {
    name: "createProject",
    data() {
      return {
        user:JSON.parse(window.sessionStorage.getItem("user")), //将保存在sessionStorage里面的数据根据key值取出来
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        project: {
          name: '',
          author: '',
          remarks: '',
        },
        projectRules: {
          name: [{ required: true, message: "请输入项目名称", trigger: "blur" }],
          remarks: [{ required: false, message: "请填写项目描述", trigger: "blur" }],
        },
      }
    },
    methods:{
      cancelDialog(){
        this.project = {
          name: '',
          author: '',
          remarks: '',
        }
      },
      conformDialog(){
        this.$message('这是一条消息提示');
      },
    },
  }
</script>

<style scoped>

</style>
